<template>
  <a-button v-bind="getBindValue" @click="onClick">
    <template #default="data">
      <slot v-bind="data || {}"></slot>
    </template>
  </a-button>
</template>

<script lang="ts">
  import { defineComponent } from 'vue';
  export default defineComponent({
    inheritAttrs: false,
  });
</script>
<script lang="ts" setup>
  import { computed, unref } from 'vue';
  import { omit } from 'lodash-es';
  import { useAttrs } from '/@/hooks/core/useAttrs';
  import { useMessage } from '/@/hooks/web/useMessage';
  import { useI18n } from '/@/hooks/web/useI18n';
 // 引入路由
 import { useRoute } from 'vue-router';
  const props = defineProps({
    modelConfirm: { type: Object },
  });
  const attrs = useAttrs({ excludeDefaultKeys: false });
  const { createConfirm } = useMessage();
  const { t } = useI18n();
  const { modelConfirm } = props;
      const route = useRoute();
      let  msg = localStorage.getItem('msg')
      if (msg=='true') {
           switch (route.path) {
             case '/permission/position':
              // 岗位管理的逻辑
              break;
             case '/permission/user':
             // 用户管理的逻辑
              break;
             case '/permission/role':
            // 角色管理的逻辑
             break;
             case '/permission/gradeManage':
             // 分级管理的逻辑
             break;
             case '/permission/group':
             // 分组管理的逻辑
             break;
             case '/permission/authorize':
            // 权限管理的逻辑
            break;
            default:
             msg='false'
             }
            }
  function onClick() {
    createConfirm({
      iconType: modelConfirm?.iconType || 'warning',
      title: modelConfirm?.title || t('common.tipTitle'),
      content: modelConfirm?.content || t('common.delTip'),
      okText:msg=='true'?"提交审核":'确定',
      onOk: modelConfirm?.onOk,
    });
  }
  const getBindValue = computed(() => omit({ ...unref(attrs) }, ['enable', 'getPopupContainer', 'label', 'onClick', 'icon']));
</script>